import { type DefaultTheme } from 'vitepress';

/**
 * 导航栏
 * @returns DefaultTheme.SidebarItem[]
 */
export function nav(): DefaultTheme.NavItem[] {
    return [
        { text: '首页', link: '/' },
        {
            activeMatch: '^/guide/',
            link: '/guide/introduction/wadv',
            text: '前端',
        },
        {
            activeMatch: '^/components/',
            link: '/components/introduction',
            text: '组件',
        },
        {
            activeMatch: '^/server/',
            link: '/server/introduction/foreword',
            text: '服务端',
        },
        // {
        //     activeMatch: '^/(guide|components)/',
        //     text: '文档',
        //     items: [
        //         {
        //             activeMatch: '^/guide/',
        //             link: '/guide/introduction/vben',
        //             text: '指南',
        //         },
        //         {
        //             activeMatch: '^/components/',
        //             link: '/components/introduction',
        //             text: '组件',
        //         },
        //         {
        //             text: '历史版本',
        //             items: [
        //                 {
        //                     link: 'https://doc.vvbin.cn',
        //                     text: '2.x版本文档',
        //                 },
        //             ],
        //         },
        //     ],
        // },
    ]
}


/**
 * 简介页面
 * @returns DefaultTheme.SidebarItem[]
 */
export function sidebarGuide(): DefaultTheme.SidebarItem[] {
    return [
        {
            collapsed: false,
            text: '简介',
            items: [
                {
                    link: 'introduction/wadv',
                    text: '关于前端',
                },
                { link: 'introduction/quick-start', text: '快速开始' },
                {
                    base: '/',
                    link: 'components/introduction',
                    text: '组件文档',
                },
                {
                    link: 'introduction/markdown',
                    text: 'Markdown文档'
                },
            ],
        },
        {
            text: '基础',
            items: [
                { link: 'essentials/development', text: '本地开发' },
                { link: 'essentials/route', text: '路由和菜单' },
                { link: 'essentials/settings', text: '配置' },
                { link: 'essentials/icons', text: '图标' },
                { link: 'essentials/styles', text: '样式' },
                { link: 'essentials/external-module', text: '外部模块' },
                { link: 'essentials/external-axios', text: '请求示例' },
                { link: 'essentials/build', text: '构建与部署' },
                { link: 'essentials/server', text: '服务端交互' },
            ],
        },
        {
            text: '深入',
            items: [
                // { link: 'in-depth/login', text: '登录' },
                // { link: 'in-depth/layout', text: '布局' },
                { link: 'in-depth/theme', text: '主题' },
                { link: 'in-depth/access', text: '权限' },
                // { link: 'in-depth/locale', text: '国际化' },
                // { link: 'in-depth/features', text: '常用功能' },
                // { link: 'in-depth/check-updates', text: '检查更新' },
                // { link: 'in-depth/loading', text: '全局loading' },
                // { link: 'in-depth/ui-framework', text: '组件库切换' },
            ],
        },
    ]
}

/**
 * 组件库
 * @returns DefaultTheme.SidebarItem[]
 */
export function sidebarComponents(): DefaultTheme.SidebarItem[] {
    return [
        {
            text: '组件',
            items: [
                {
                    link: '../guide/introduction/wadv',
                    text: '关于前端',
                },
                {
                    link: 'introduction',
                    text: '介绍',
                },
            ],
        },
        {
            collapsed: false,
            text: '高级表格组件',
            items: [
                {
                    link: 'common-ui/grid/preface',
                    text: '前言',
                },
                {
                    link: 'common-ui/grid/menu',
                    text: '菜单创建',
                },
                {
                    link: 'common-ui/grid/template-grid',
                    text: '表格配置',
                },
                {
                    link: 'common-ui/grid/template-query',
                    text: '查询栏配置',
                },
                {
                    link: 'common-ui/grid/template-form',
                    text: '表单配置',
                },
                {
                    link: 'common-ui/grid/parameters',
                    text: '默认参数',
                },
                {
                    link: 'common-ui/grid/format',
                    text: '参数格式化',
                },
                {
                    link: 'common-ui/grid/linkage',
                    text: '表单联动',
                },
                {
                    link: 'common-ui/grid/word',
                    text: '导出Word',
                },
                {
                    link: 'common-ui/grid/group',
                    text: '多表配置',
                }
            ],
        },
        // {
        //     collapsed: false,
        //     text: '通用组件',
        //     items: [
        //         {
        //             link: 'common-ui/template-grid',
        //             text: '高级表格组件',
        //         }
        //     ],
        // },
    ]
}
